package com.sunny.hp.common.util;

import java.lang.reflect.Array;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class MybatisUtil {
	/**
	 * isEmpty
	 * @param obj
	 * @return
	 */
    public static boolean isEmpty(Object obj){        
    	if( obj instanceof String ) return obj==null || "".equals(obj.toString().trim());        
    	else if( obj instanceof List ) return obj==null || ((List)obj).isEmpty();        
    	else if( obj instanceof Map ) return obj==null || ((Map)obj).isEmpty();        
    	else if( obj instanceof Object[] ) return obj==null || Array.getLength(obj)==0;        
    	else return obj==null;    
    }
    
    /**
     * isNotEmpty
     * @param s
     * @return
     */
    public static boolean isNotEmpty(Object obj){
    	return !isEmpty(obj);    
    }
    
    public static String subStringValue(String str, int startInt, int endInt){
    	return str = str.substring(startInt, endInt);
    	
    }
    
    /**********************************************************************
     * <PRE> * 공백 제거 *
     * 1. MethodName	: replaceAll
     * 2. ClassName		: MybatisUtil
     * 3. 작성자			: P044826
     * 4. 작성일			: 2014. 2. 6. 오후 2:25:38
     * 5. 설명				:
     * </PRE>
     * 		@return String
     * 		@param str
     * 		@param startInt
     * 		@param endInt
     * 		@return
    **********************************************************************/
    public static String replaceAll(String str, String source,  String target){
    	return str = str.replaceAll(source, target);
    	
    }
    
    public static void main(String[] args) throws Exception{
		LinkedList selEnergySystemList = new LinkedList();
		//System.out.println(isNotEmpty(selEnergySystemList));
    }
}
